function allCovs = GenerateCovariates_Localizer(saveBool)


sequence = '---------------FFFFFFFFFFFFFFFBBBBBBBBBBBBBBBOOOOOOOOOOOOOOOSSSSSSSSSSSSSSS---------------OOOOOOOOOOOOOOOSSSSSSSSSSSSSSSFFFFFFFFFFFFFFFBBBBBBBBBBBBBBB---------------BBBBBBBBBBBBBBBSSSSSSSSSSSSSSSOOOOOOOOOOOOOOOFFFFFFFFFFFFFFF---------------SSSSSSSSSSSSSSSFFFFFFFFFFFFFFFOOOOOOOOOOOOOOOBBBBBBBBBBBBBBB---------------';
stimDur = 1;


%% CHECK INPUTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

if nargin < 1
    saveBool = 0;
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Define covariates
mainEffect = ~(sequence == '-');
faceCov = sequence == 'F';
objectCov = sequence == 'O';
scenesCov = sequence == 'B';
scrambledCov = sequence == 'S';

if saveBool
    if ~exist('./covariates/', 'dir')
        mkdir('./covariates/');
    end
    if ~exist('./covariates/localizer/', 'dir')
        mkdir('./covariates/localizer/');
    end
    
    mainEffect_fileID = fopen('./covariates/localizer/mainEffect.txt','w');
    faceCov_fileID = fopen('./covariates/localizer/covFaces.txt','w');
    objectCov_fileID = fopen('./covariates/localizer/covObjects.txt','w');
    scenesCov_fileID = fopen('./covariates/localizer/covScenes.txt','w');
    scrambledCov_fileID = fopen('./covariates/localizer/covScrambled.txt','w');
    
    for trial=1:(length(sequence)-1)
        if(mainEffect(trial)~=0); fprintf(mainEffect_fileID,'%f\t%f\t%f\n',stimDur*(trial-1),stimDur,mainEffect(trial)); end
        if(faceCov(trial)~=0); fprintf(faceCov_fileID,'%f\t%f\t%f\n',stimDur*(trial-1),stimDur,faceCov(trial)); end
        if(objectCov(trial)~=0); fprintf(objectCov_fileID,'%f\t%f\t%f\n',stimDur*(trial-1),stimDur,objectCov(trial)); end
        if(scenesCov(trial)~=0); fprintf(scenesCov_fileID,'%f\t%f\t%f\n',stimDur*(trial-1),stimDur,scenesCov(trial)); end
        if(scrambledCov(trial)~=0); fprintf(scrambledCov_fileID,'%f\t%f\t%f\n',stimDur*(trial-1),stimDur,scrambledCov(trial)); end
    end
        
	fclose('all');
    
end
    


allCovs.mainEffect = mainEffect;
allCovs.faceCov = faceCov;
allCovs.objectCov = objectCov;
allCovs.scenesCov = scenesCov;
allCovs.scrambledCov = scrambledCov;